<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/utils/attribute.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(../../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="../../index.html">All files</a> / <a href="index.html">src/utils</a> attribute.js
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/47</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/48</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/12</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/31</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75</td><td class="line-coverage quiet"><span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import DateIn<span class="cstat-no" title="statement not covered" >fo from './dateInfo';<span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ></span></span></span>
import defaults <span class="cstat-no" title="statement not covered" >from './defaults';<span class="cstat-no" title="statement not covered" ></span></span>
import { mixinO<span class="cstat-no" title="statement not covered" >ptionalProps, arrayHa</span>sItems } from './helpers';
import { isArray } f<span class="cstat-no" title="statement not covered" >rom './typeCheckers';<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" ></span></span></span>
&nbsp;
const Attribute <span class="cstat-no" title="statement not covered" >= (config<span class="fstat-no" title="function not covered" >) =&gt; {</span></span>
<span class="cstat-no" title="statement not covered" >  if (!config) <span class="cstat-no" title="statement not covered" >return null;</span></span>
<span class="cstat-no" title="statement not covered" >  if (config.isAttribute) <span class="cstat-no" title="statement not covered" >return config;</span></span>
<span class="cstat-no" title="statement not covered" >  if (config.dates &amp;&amp; !isArray(config.dates)) config.dates = [con<span class="cstat-no" title="statement not covered" >fig.dates];</span></span>
<span class="cstat-no" title="statement not covered" >  if (config.excludeDates &amp;&amp; !isArray(config.excludeDates)) config.excludeDates<span class="cstat-no" title="statement not covered" > = [config.excludeDates];</span></span>
  const hasDates <span class="cstat-no" title="statement not covered" >= arrayHasItems(config.dates);</span>
  const hasExcludeDates <span class="cstat-no" title="statement not covered" >= arrayHasItems(config.excludeDates);</span>
  const dates =
<span class="cstat-no" title="statement not covered" >    (</span>
      (hasDates &amp;&amp; config.dates) || // Use provided dates if they have items
      (hasExcludeDates &amp;&amp; [{}]) ||  // Use infinite range if exclude dates were provided
      []                            // Use just an empty array
    )
    .m<span class="fstat-no" title="function not covered" >ap</span>(d =&gt; (d.isD<span class="cstat-no" title="statement not covered" >ateInfo ? d : DateInfo(d, config.order)));</span>
  const excludeDates =
<span class="cstat-no" title="statement not covered" >    (</span>
      (hasExcludeDates &amp;&amp; config.excludeDates) ||
      []
    )
    .m<span class="fstat-no" title="function not covered" >ap</span>(d =&gt; (d.isD<span class="cstat-no" title="statement not covered" >ateInfo ? d : DateInfo(d, config.order)));</span>
  const isComplex <span class="cstat-no" title="statement not covered" >= dates.som<span class="fstat-no" title="function not covered" >e(</span>d =&gt; d.isCom<span class="cstat-no" title="statement not covered" >plex);</span></span>
  const attr <span class="cstat-no" title="statement not covered" >= {</span>
    isAttribute: true,
    key: config.key || 'guid',
    order: config.order || 0,
    dates,
    excludeDates,
    isComplex,
    // Any date partly intersects with given date
    intersectsDate: (date) =&gt;<span class="fstat-no" title="function not covered" > {</span>
      const dateInfo <span class="cstat-no" title="statement not covered" >= DateInfo(date);</span>
      const matchDate <span class="cstat-no" title="statement not covered" >= dates.fin<span class="fstat-no" title="function not covered" >d(</span>d =&gt; d.inter<span class="cstat-no" title="statement not covered" >sects(dateInfo));</span></span>
<span class="cstat-no" title="statement not covered" >      if (!matchDate || !hasExcludeDates) <span class="cstat-no" title="statement not covered" >return matchDate;</span></span>
      const matchExDate <span class="cstat-no" title="statement not covered" >= excludeDates.fin<span class="fstat-no" title="function not covered" >d(</span>ed =&gt; ed.incl<span class="cstat-no" title="statement not covered" >udes(dateInfo));</span></span>
<span class="cstat-no" title="statement not covered" >      return matchExDate ? false : matchDate;</span>
    },
    // Accepts: DayInfo object
    // Returns: First attribute date or date range that occurs on given day.
    includesDay: dayInfo =<span class="fstat-no" title="function not covered" >&gt; dates<span class="cstat-no" title="statement not covered" ></span></span>
      .map<span class="fstat-no" title="function not covered" >(d</span> =&gt; d.includ<span class="cstat-no" title="statement not covered" >esDay(dayInfo))</span>
      .find<span class="fstat-no" title="function not covered" >((</span>d) =&gt; {
        // Date doesn't match
<span class="cstat-no" title="statement not covered" >        if (!d) <span class="cstat-no" title="statement not covered" >return null;</span></span>
        // No exclude dates to check - just return first match
<span class="cstat-no" title="statement not covered" >        if (!hasExcludeDates) <span class="cstat-no" title="statement not covered" >return d;</span></span>
        // Return date if it isn't part of the excluded dates
<span class="cstat-no" title="statement not covered" >        return excludeDates.find(<span class="fstat-no" title="function not covered" >ed</span> =&gt; ed.includ<span class="cstat-no" title="statement not covered" >esDay(dayInfo)) ? false : d;</span></span>
      }),
  };
<span class="cstat-no" title="statement not covered" >  mixinOptionalProps(config, attr, [</span>
    { name: 'highlight', mixin: defaults.highlight },
    { name: 'highlightCaps', mixin: defaults.highlightCaps },
    { name: 'dot', mixin: defaults.dot },
    { name: 'dotCaps' },
    { name: 'bar', mixin: defaults.bar },
    { name: 'barCaps' },
    { name: 'contentStyle' },
    { name: 'contentStyleCaps' },
    { name: 'contentHoverStyle' },
    { name: 'popover' },
    { name: 'customData' },
  ]);
  // Do some cleanup configuration for highlights
<span class="cstat-no" title="statement not covered" >  if (attr.highlight &amp;&amp; !attr.highlight.borderRadius) <span class="cstat-no" title="statement not covered" >attr.highlight.borderRadius = attr.highlight.height;</span></span>
  // Return the attribute
<span class="cstat-no" title="statement not covered" >  return attr;</span>
};<span class="cstat-no" title="statement not covered" ></span>
&nbsp;
export default Attribute;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri Jan 05 2018 09:47:39 GMT-0600 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>
